package com.hancheng.goodscloud.feign.controller;

import com.hancheng.commoncloud.framework.result.Response;
import com.hancheng.goodscloud.business.entity.dto.SubtractQuantityDTO;
import com.hancheng.goodscloud.business.service.GoodsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "商品表（远程调用内部接口）")
@RestController
@RequestMapping("/api/goods/feign")
public class GoodsFeignController {
    @Autowired
    private GoodsService goodsService;

    @ApiOperation(value = "扣减库存", httpMethod = "POST")
    @PostMapping("/subtractQuantity")
    public Response<Void> subtractQuantity(@RequestBody SubtractQuantityDTO subtractQuantityDTO) {
        goodsService.subtractQuantity(subtractQuantityDTO);
        return Response.ok();
    }
}
